#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#define N 10

typedef void (*callback_t)();

void Worker()
{
    int cnt = 10;
    while(cnt)
    {
        printf("I am child process, pid: %d, ppid: %d, cnt: %d\n", getpid(), getppid(), cnt);
        sleep(1);
        cnt--;
    }
}

int main()
{
    int i=0;
    for(i = 0; i < N; i++)
    {
        sleep(1);
        pid_t id = fork();
        if(id == 0)
        {
            printf("create child process success: %d\n", i);
            // child
            Worker();
            exit(0);
        }
    }
    return 0;
}
